
[#macro sitetenantUpdateView]
    <div class="model-form">
        <el-page-header @back="goBack" content="更新租户管理">
        </el-page-header>
        <div class="model-content">
            <el-form ref="ruleForm" :rules="rules" :model="form" label-width="160px" >
                <el-row :gutter="10">
 <el-col :span="12">
     <el-form-item label="标识" size="mini" prop="key">
             <el-input v-model="form.key" name="key">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="名称" size="mini" prop="name">
             <el-input v-model="form.name" name="name">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="域名" size="mini" prop="domain">
             <el-input v-model="form.domain" name="domain">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="logo" size="mini" prop="logo">
             <el-input v-model="form.logo" name="logo">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="电话" size="mini" prop="phone">
             <el-input v-model="form.phone" name="phone">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="地址" size="mini" prop="address">
             <el-input v-model="form.address" name="address">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="theme" size="mini" prop="theme">
             <el-input v-model="form.theme" name="theme">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="租户介绍" size="mini" prop="note">
             <el-input v-model="form.note" name="note" type="textarea"></el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="客服签名" size="mini" prop="chatSign">
             <el-input v-model="form.chatSign" name="chatSign" type="textarea"></el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="类型" size="mini" prop="catalog">
             <el-input v-model="form.catalog" name="catalog">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="开始日期" size="mini" prop="beginDate">
            <el-date-picker v-model="form.beginDate" type="date"   value-format="yyyy-MM-dd"  placeholder="选择日期">
            </el-date-picker>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="到期日期" size="mini" prop="expireDate">
            <el-date-picker v-model="form.expireDate" type="date"   value-format="yyyy-MM-dd"  placeholder="选择日期">
            </el-date-picker>
     </el-form-item>
      
 </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24"  style="text-align: right;padding-bottom: 20px;padding-top: 20px;">
                        <el-button @click="goBack">取消</el-button>
                        <el-button type="primary" @click="updateData">确定</el-button>
                    </el-col>
			     </el-row>
            </el-form>
        </div>
    </div>
[/#macro]

[#macro sitetenantUpdateConfig]
<script type="text/x-template" id="my-sitetenant-update">
    [@sitetenantUpdateView /]
</script>
<script type="text/javascript">
    //更新组件开始
    var sitetenantUpdateConfig = {};
    sitetenantUpdateConfig.template = "#my-sitetenant-update";
    sitetenantUpdateConfig.methods = config.basicMethod();
    sitetenantUpdateConfig.methods.updateData = function () {
        var self = this;
        this.$refs["ruleForm"].validate(function(valid){
            if (valid) {
                self.updateDataPost();
            } else {
                console.log('error submit!!');
                return false;
            }
        });
    }

    sitetenantUpdateConfig.methods.updateDataPost = function () {
        var self = this, data = this.form;
        //delete data.sitetenantCatalog;
        if (this.deforeUpdateData) {
            this.deforeUpdateData();
        }
        this.postData("${siteurl}tenantRest/sitetenant/update.htm", data, function (res) {
            if (res.code == 0) {
                self.$message({
                    message: '修改数据成功',
                    type: 'success'
                });
                //window.history.go(-1)
                self.$router.go(-1);
            } else {
                self.$message.error(res.msg);
            }
        });
    }
    sitetenantUpdateConfig.data = function () {
        return {
            form: {
                key: '',
                name: '',
                domain: '',
                logo: '',
                phone: '',
                address: '',
                theme: '',
                note: '',
                chatSign: '',
                catalog: '',
                beginDate: '',
                expireDate: ''            },
            rules: {
                    key: [
                        { required: true, message: '请输入标识', trigger: 'blur' }
                    ],
            }
        }
    };

    sitetenantUpdateConfig.mounted = function () {
        var id = this.$route.query.id;
        var self = this;
        var data = {};
        data.id = id;
        this.postData("${siteurl}tenantRest/sitetenant/view.htm", data, function (res) {
            if (res.code == 0) {
                self.form = res;
            }
        });
    }
    sitetenantUpdateConfig.computed = {};

    sitetenantUpdateConfig.destroyed = function () {
            console.log("destroyed add view ");
            
	}
    var sitetenantUpdateView = Vue.component('update-view', sitetenantUpdateConfig);
    //更新组件结束
</script>
[/#macro]